﻿using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Data;
using System.Collections.Generic;

namespace MyWebPagesStarterKit
{
    /// <summary>
    /// Summary description for CustomData
    /// </summary>
    public class CustomData : Section<CustomData.Data>
    {

        public CustomData() : base() { }
        public CustomData(string id) : base(id) { }

        private CustomHtml _instance;

        public string GetHtml(string guid)
        {
            _instance = CustomHtml.GetInstance();
            DataRow row = _instance.GetRowFromKey(guid);
            if (row != null)
            {
                return Convert.ToString(row["Html"]);
            }
            return string.Empty;
        }

        public override List<SearchResult> Search(string searchString, WebPage page)
        {
            List<SearchResult> list = new List<SearchResult>();
            return list;
        }

        public override Position Position
        {
            get
            {
                return _data.Position;
            }
            set
            {
                _data.Position = value;
            }
        }

        public override bool IsOnline
        {
            get
            {
                return _data.IsOnline;
            }
            set
            {
                _data.IsOnline = value; ;
            }
        }

        public string SectionID
        {
            get { return _data.SectionID; }
            set { _data.SectionID = value; }
        }

        public class Data
        {
            public bool IsOnline = true;
            public Position Position;
            public string SectionID = string.Empty;
        }

      
    }
}
